const config = {
  // logo: 'http://localhost/api/logo/UserLogin.php',
  logo: 'http://api.lzdkjy.cn/logo/UserLogin.php'
    // base_img: 'http://www.baidu.com',
}
const DingConf = function(data) {
  alert(data)
}

//ajax
const lzd_ajax = {};
lzd_ajax.ajaxpost = function(_this, urs, datamesg, template, erfunc) {
  _this.$http.post(urs, datamesg, {
    headers: {
      "X-Requested-With": "XMLHttpRequest"
    },
    emulateJSON: true
  }).then(function(response) {
    template(response.data)
      // self.b = response.data;
      //  alert(typeof response.data)
      // lzd_localStorage(2,response.data);
      // this.$router.push('/home')
  }), (function(response) {
    erfunc()
  });
}

const lzd_cont = {};
// lzd_cont.GetUrlParms = function() {
//   var args = new Object();
//   var query = location.search.substring(1); //获取查询串
//   var pairs = query.split("&"); //在逗号处断开
//   for (var i = 0; i < pairs.length; i++) {
//     var pos = pairs[i].indexOf('='); //查找name=value
//     if (pos == -1) continue; //如果没有找到就跳过
//     var argname = pairs[i].substring(0, pos); //提取name
//     var value = pairs[i].substring(pos + 1); //提取value
//     args[argname] = decodeURI(value); //存为属性
//   }
//   return args;
// }


const lzd_localStorage = {};
// lzd_localStorage.localStorage = function(type, obj) {
//   if (type == 1) {
//     var str = localStorage.userData;
//     return localStorage.userData ? JSON.parse(localStorage.userData) : 0;
//   } else if (type == 2) {
//     localStorage.userData = JSON.stringify(obj);
//   }
// }

lzd_localStorage.localStorage = (type, obj) => {
  if (type == 1) {
    var str = localStorage.userData;
    return localStorage.userData ? JSON.parse(localStorage.userData) : 0;
  } else if (type == 2) {
    localStorage.userData = JSON.stringify(obj);
  }
}

export {
  config,
  lzd_cont,
  lzd_ajax,
  lzd_localStorage,
}
